import * as Blockly from 'blockly/core';
import * as generator_arduino from './generators/generator_arduino';
import * as generators_micropython from './generators/generator_micropython';
import * as blocks from './blocks/block';
import './language/loader';
import './css/lib.css';

// 载入图形化模块外观定义文件
Object.assign(Blockly.Blocks, blocks);

// 载入MicroPython图形化模块代码生成定义文件
if (Blockly.Python) {
    if (Blockly.Python.forBlock) {
        Object.assign(Blockly.Python.forBlock, generators_micropython);
    } else {
        Object.assign(Blockly.Python, generators_micropython);
    }
}
// 载入Arduino图形化模块代码生成定义文件
else if (Blockly.Arduino) {
    if (Blockly.Arduino.forBlock) {
        Object.assign(Blockly.Arduino.forBlock, generator_arduino);
    } else {
        Object.assign(Blockly.Arduino, generator_arduino);
    }
}
else if(Blockly.OtherGenerator)
{
    if (Blockly.OtherGenerator.forBlock) {
        Object.assign(Blockly.OtherGenerator.forBlock, generator_arduino);
    } else {
        Object.assign(Blockly.OtherGenerator, generator_arduino);
    }
}

